package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.entities.Dept;
import com.atguigu.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : leimingchao
 * @date Date : 2021年11月01日 23:35
 */
@RestController
@RequestMapping(value = "/consumer")
public class DeptController {


    @Autowired
    private DeptClientService deptClientService;

    @GetMapping(value = "/dept/get/{id}")
    public Dept get(@PathVariable(value = "id") Long id) {
        return deptClientService.get(id);
    }

    @GetMapping(value = "/dept/list")
    public List<Dept> list() {
        return deptClientService.list();
    }

    @GetMapping(value = "/dept/add")
    public boolean add(Dept dept) {
        return deptClientService.add(dept);
    }
}
